#include <iostream>
#include <iomanip>
#include <string>
#include <cmath>
#include <vector>
#include <algorithm>

using namespace std;

typedef long long ll;
const int M = 1000LL * 1000* 1000 + 7;

inline void solve(const int n, const ll d, const int x, vector<int>& res, vector<int>& t){
	if (d == 1) {
		fill(res.begin(), res.begin() + min(n, x) + 1, 1);
		fill(res.begin() + min(n, x) + 1, res.end(), 0);
		return;
	}
	solve(n, d / 2, x, t, res);
	fill(res.begin(), res.end(), 0);
	for (int i = 0; i <= n; ++i)
		for (int j = 0; j + i <= n; ++j){
			res[i + j] += 1LL * t[i] * t[j] % M;
			res[i + j] %= M;
		}
	if (d & 1){
		swap(res, t);
		fill(res.begin(), res.end(), 0);
		for (int i = 0; i <= n; ++i)
			for (int j = 0; j + i <= n && j <= min(n, x); ++j){
				res[i + j] += t[i];
				res[i + j] %= M;
			}
	}
}

int main(){
	ios_base::sync_with_stdio(false);
	int n, x;
	ll d;
	vector<int> a(2001), b(2001);
	while (true){
		fill(a.begin(), a.end(), 0);
		fill(b.begin(), b.end(), 0);
		cin >> n >> d >> x;
		--x;
		if (n == 0) break;
		solve(n, d, x, a, b);
		cout << a[n] << endl;
	}
	return 0;
}